<?php

/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use common\widgets\Alert;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>

<div class="wrap">
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="<?= Yii::$app->homeUrl ?>">Yii2 Frontend</a>
            </div>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="<?= Url::toRoute('site/index') ?>">Home</a></li>
                <li><a href="<?= Url::toRoute('site/about') ?>">About</a></li>
                <li><a href="<?= Url::toRoute('site/contact') ?>">Contact</a></li>
                <li><a href="<?= Url::toRoute('customer/index') ?>">Customer</a></li>
                <?php if (Yii::$app->user->isGuest) { ?>
                    <li><a href="<?= Url::toRoute('site/signup') ?>">Signup</a></li>
                    <li><a href="<?= Url::toRoute('site/login') ?>">Login</a></li>
                <?php } else { ?>
                    <li>
                        <a href="<?= Url::toRoute('site/logout') ?>" data-method="post">
                            Logout(<?= Yii::$app->user->identity->username ?>)
                        </a>
                    </li>
                <?php } ?>
                <li><a href="<?= Url::toRoute('email/index') ?>">Email</a></li>
                <li><a href="<?= Url::toRoute('company/index') ?>">Company</a></li>
                <li><a href="<?= Url::toRoute('branch/index') ?>">Branch</a></li>
                <li><a href="<?= Url::toRoute('department/index') ?>">Department</a></li>
            </ul>
        </div>
    </nav>

    <div class="container">
        <?= Breadcrumbs::widget([
            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
        ]) ?>
        <?= Alert::widget() ?>
        <?= $content ?>
    </div>
</div>

<footer class="footer">
    <div class="container">
        <p class="pull-left">&copy; My Company <?= date('Y') ?></p>
        <p class="pull-right"><?= Yii::powered() ?></p>
    </div>
</footer>

<?php $this->endBody() ?>

<?php if(isset($this->blocks['scripts'])): ?>
    <?= $this->blocks['scripts'] ?>
<?php endif ?>

</body>
</html>
<?php $this->endPage() ?>
